/*
state  存放数据
mutations 同步修改数据
actions  异步修改数据 (调用了mutations)
 */

export const state = () => ({
  draftHistory: [],
  index: 0
})

export const mutations = {
  push(state, data) {
    state.index++
    console.log(data);
    data.id = state.index
    state.draftHistory.unshift(data);
  },
  delete(state, data) {
    state.draftHistory.splice(data, 1)
  }
}
